'use strict';

module.exports = {
  up: async (queryInterface, Sequelize) => {
    await queryInterface.createTable('favorite', { 
      id: {
        allowNull: false,
        autoIncrement: true,
        primaryKey: true,
        type: Sequelize.INTEGER,
        comment: 'id'
      },
      cookbook_id: {
        type: Sequelize.INTEGER,
        allowNull: false,
        defaultValue: 0,
        comment: 'id'
      },
      user_id: {
        type: Sequelize.INTEGER,
        allowNull: false,
        defaultValue: 0,
        comment: '用户id'
      },
      created_ip_at: {
        type: Sequelize.CHAR(15),
        allowNull: false,
        field: 'created_ip_at',
        defaultValue: '',
        comment: '收藏的ip地址'
      },
      undated_ip_at: {
        type: Sequelize.CHAR(15),
        allowNull: false,
        field: 'updated_ip_at',
        defaultValue: '',
        comment: '收藏更新的ip地址'
      },
      created_at: {
        allowNull: false,
        type: Sequelize.DATE,
        filed: 'created_at',
        comment: '收藏的时间'
      },
      updated_at: {
        allowNull: false,
        type: Sequelize.DATE,
        filed: 'updated_at',
        comment: '收藏更新的时间'
      }
      }, {
        tableName: 'favorite',
        charset: 'utf8mb4',
        collate: 'utf8mb4_bin',
        indexes: [
          {

          }
        ]
    });
  },

  down: async (queryInterface, Sequelize) => {
    await queryInterface.dropTable('favorite');
  }
};
